package com.lxl.settings.service.impl;

import com.lxl.commons.mapper.IMapper;
import com.lxl.commons.mapper.impl.AdministratorMapperImpl;
import com.lxl.commons.mapper.impl.CategoryStaffMapperImpl;
import com.lxl.commons.mapper.impl.CommonStaffMapperImpl;
import com.lxl.commons.mapper.impl.CuratorMapperImpl;
import com.lxl.settings.dao.StaffDao;
import com.lxl.settings.dao.StaffDaoImpl;
import com.lxl.settings.service.StaffService;
import com.lxl.workbench.entity.Administrator;
import com.lxl.workbench.entity.CategoryStaff;
import com.lxl.workbench.entity.CommonStaff;
import com.lxl.workbench.entity.Curator;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 北上寻海
 */
public class StaffServiceImpl implements StaffService {
    /**
     * 转化结果集的对象
     */
    IMapper commonStaffMapper = new CommonStaffMapperImpl();
    IMapper categoryStaffMapper = new CategoryStaffMapperImpl();
    IMapper curatorMapper = new CuratorMapperImpl();
    IMapper administrator = new AdministratorMapperImpl();

    /**
     *Dao层的对象
     */
    StaffDao staffDao = new StaffDaoImpl();

    @Override
    public List<CommonStaff> queryCommonStaffById(String id) throws SQLException {
        return commonStaffMapper.mapper(staffDao.judgePermissionsCommon(id)) ;
    }

    @Override
    public List<Curator> queryCuratorById(String id) throws SQLException {
        return curatorMapper.mapper(staffDao.judgePermissionsCurator(id));
    }

    @Override
    public List<CategoryStaff> queryCategoryStaffById(String id) throws SQLException {
        return categoryStaffMapper.mapper(staffDao.judgePermissionsCategory(id));
    }

    @Override
    public List<Administrator> queryAdministratorById(String id) throws SQLException {
        return administrator.mapper(staffDao.judgePermissionsAdministrator(id));
    }
}
